@extends('layouts.adminLayouts')

@section('mainContent')

    <div class="box">
        <div class="box-header">
            <div class="box-title">
                编辑菜单信息
            </div>
            <div class="box-tools">
                <div class="btn-group-sm">
                    <a class="btn btn-default" href="javascript:history.back();">
                        <i class="fa fa-mail-reply"></i>
                    </a>
                </div>
            </div>
        </div>
        <form class="form-horizontal" action="" method="post">
            <div class="box-body">
                <div class="form-group">
                    <label class="control-label col-md-2">上级编号</label>
                    <div class="col-md-6">

                        <select class="select2Console form-control" name="data[parent_id]">

                            <option value="0" @if($info->parent_id == 0) selected @endif>顶级编号</option>
                            @forelse($query as $row)

                                <option value="{{$row['id']}}"
                                        @if($info->parent_id == $row['id']) selected @endif>{{$row['name']}}</option>
                                @foreach($row['son'] as $name)
                                    <option value="{{$name['id']}}"
                                            @if($info->parent_id == $name['id']) selected @endif>
                                        {{str_repeat('&nbsp;&nbsp;&nbsp;&nbsp;', $row['laraevl'] + 2)}}{{$name['name']}}
                                    </option>
                                    @foreach($name['son'] as $v)
                                        <option value="{{$v['id']}}" @if($info->parent_id == $v['id']) selected @endif>
                                            {{str_repeat('&nbsp;&nbsp;&nbsp;&nbsp;', $row['laraevl'] + 4)}}{{$v['name']}}
                                        </option>
                                    @endforeach
                                @endforeach
                            @empty

                            @endforelse

                        </select>

                    </div>
                </div>

                <div class="form-group">
                    <label class="control-label col-md-2">菜单名称</label>
                    <div class="col-md-6">
                        <input type="text" class="form-control" name="data[name]" value="{{$info->name}}">
                    </div>
                </div>

                <div class="form-group">
                    <label class="control-label col-md-2">连接</label>
                    <div class="col-md-6">
                        <input type="text" class="form-control" name="data[url]" value="{{$info->url}}">
                    </div>
                </div>

                <div class="form-group">
                    <label class="control-label col-md-2">控制器</label>
                    <div class="col-md-6">
                        <input type="text" class="form-control" name="data[controller]" value="{{$info->controller}}">
                    </div>
                </div>

                <div class="form-group">
                    <label class="control-label col-md-2">系统调用名</label>
                    <div class="col-md-10">
                        <input type="text" class="form-control" name="data[sulg]" value="{{$info->sulg}}">
                    </div>
                </div>

                <div class="form-group">
                    <label class="control-label col-md-2">图标</label>
                    <div class="col-md-6">
                        <input type="text" name="data[icon]" class="fontIconPicker" value="{{$info->icon}}"/>
                        <span class="help-block">
                                <i class="fa fa-info-circle"></i>&nbsp;字体详情可以查看
                                <a href="http://fontawesome.io/icons/"
                                   target="_blank">http://fontawesome.io/icons/</a>
                            </span>
                    </div>
                </div>

                <div class="form-group">
                    <label class="control-label col-md-2">图标</label>
                    <div class="col-md-10">
                        <input type="checkbox" name="data[is_show]" value="1"
                               @if($info->is_show == 1) checked="checked" @endif/>菜单显示?
                    </div>
                </div>

            </div>
            <div class="box-footer">
                <div class="col-md-2"></div>
                <div class="col-md-6">
                    {{csrf_field()}}
                    <div class="btn-group pull-left">
                        <button class="btn btn-success">提交</button>
                    </div>
                    <div class="btn-group pull-right">
                        <button type="reset" class="btn btn-danger">撤销</button>
                    </div>
                </div>
            </div>
        </form>
    </div>

@endsection